import java.util.Comparator;
import java.util.PriorityQueue;

public class PriorityQueueUse {
    public static void main(String[] args) {
        PriorityQueue<BM5.ListNode> priorityQueue = new PriorityQueue<>(
                new Comparator<BM5.ListNode>() {
                    @Override
                    public int compare(BM5.ListNode o1, BM5.ListNode o2) {
                        return o2.val - o1.val;
                    }
                }
        );
        BM5.ListNode node4 = new BM5.ListNode(4);
        BM5.ListNode node7 = new BM5.ListNode(7);
        BM5.ListNode node1 = new BM5.ListNode(1);
        BM5.ListNode node2 = new BM5.ListNode(2);
        BM5.ListNode node6 = new BM5.ListNode(6);
        priorityQueue.offer(node4);
        priorityQueue.offer(node7);
        priorityQueue.offer(node1);
        priorityQueue.offer(node2);
        priorityQueue.offer(node6);
        assert priorityQueue.peek() != null;
        System.out.println(priorityQueue.peek().val);
    }
}
